/*
 * CompareDNA.h
 *
 *  Created on: May 3, 2011
 *      Author: HTPC
 */

#ifndef COMPAREDNA_H_
#define COMPAREDNA_H_

class CompareDNA{
public:
	///Distance Matrix functions
	void setValueInDistanceMatrix(int i, int j);
	void initializeDistanceMatrix(int size);

	///UPGMA functions
	void buildNewickUPGMA(std::vector<std::string> FileList);

	///Comparison functions provided through the interface
	void NeedlemanWunsch(DNA *DNASequence1, DNA *DNASequence2, int gapP);
	void SmithWaterman(DNA *DNASequence1, DNA *DNASequence2, int openGapP, int extendGapP);

	///Scoring Matrix default initializations
	void basicScoringMatrix();
	void standardScoringMatrix();

	///Printing functions provided through the interface
	void printTwoAlignedSequences(DNA *Sequence1, DNA * Sequence2, std::string type);
	void printScoringMatrix();
	void printDistanceMatrix();

	///Default constructor
	CompareDNA();
	~CompareDNA();

private:
	///General Functions
	int CompareResidue(char DNAResidue1, char DNAResidue2);
	void calcPercentDifference(DNA *DNASequence1, DNA *DNASequence2);
	void initializeComparisonMatrix(DNA *DNASequence1, DNA *DNASequence2, int openGapP);

	///NeedleMan Wunsch Functions
	void scoreNeedlemanWunsch(DNA *DNASequence1, DNA *DNASequence2);
	void traceBackNeedlemanWunsch(DNA *DNASequence1, DNA *DNASequence2);

	///Smith-Waterman Functions
	std::vector<int> scoreSmithWaterman(DNA *DNASequence1, DNA *DNASequence2, int openGapP, int extendGapP);
	void traceBackSmithWaterman(DNA *DNASequence1, DNA *DNASequence2, std::vector<int> highestCoordinates);

	///UPGMA functions
	std::vector<int> findSmallestDistance();
	void joiningUPGMA(std::vector<std::string>FileList);

	///printing functions
	void printComparisonMatrix();

	///member variables
	std::vector< std::vector< int > > ComparisonMatrix;
	std::vector< std::vector< int > > ScoringMatrix;
	std::vector< std::vector< int > > DistanceMatrix;
	std::vector< std::vector< int > > AdjustedDistanceMatrix;

	int openingGapPenalty;
	int extendingGapPenalty;
	double MisMatch;
	int Score;
};

#endif /* COMPAREDNA_H_ */
